<?php
class CommentModel {
	var $DB;
	function __construct ($DB) {
		$this->DB = $DB;
	} 

	function getOne($id) {
		$sql = "SELECT * FROM movie_comments WHERE id = '$id' ";
		$this->DB->query($sql);
		return $this->DB->fetchRow();
	}

	function editOne($id,$addtime,$contents) {
		$sql = "UPDATE movie_comments SET addtime='$addtime',contents='$contents' WHERE id = '$id'";
		$this->DB->query($sql);
		return $this->DB->affectedRows();
	}

	function delOne($id) {
		$sql = "DELETE FROM movie_comments WHERE id = '$id'" ;
		$this->DB->query($sql);
		return $this->DB->affectedRows();
	} 
} 

?>
